package com.qs.commen;

import java.io.Serializable;

public class Response implements Serializable {


    private static final long serialVersionUID = 4778739502193861897L;
    /**
     * 状态码 200 成功
     * 500后端错误
     * 600用户名不存在
     * 601  密码错误
     */
    private  int code;
    private Object data;
    private String msg;
    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
    public Response() {
    }

    public Response(int code, Object data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public Response(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Response(int code, Object data) {
        this.code = code;
        this.data = data;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
    public  static Response success(String message){
        return new Response(200,message);
    }
    public static Response error(){
        return  new Response(400,"操作失败");
    }
    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
